package com.example.day23;

/**
 * @author Lenovo
 */
public class SupplierTest {
    public static void main(String[] args) {
        int[] arr ={19,50,28,37,46};
        int maxvalue = getMax(()->{
            int max = arr[0];
            for (int i = 1; i < arr.length; i++) {
                if(max<arr[i]){
                    max = arr[i];
                }
            }
            return max;
        });
        System.out.println("最大值是："+maxvalue);
    }
    public static int getMax(Supplier<Integer> sup){
        return sup.get();
    }
}
